<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\AdminUser;
use Illuminate\Http\Request;
use test\Mockery\Fixtures\EmptyTestCaseV5;

class LoginController extends Controller
{

    /*
     * 用户登录
     * */
    public function login(Request $request, AdminUser $adminUser)
    {
        $res = $adminUser->whereaccount($request->account)->get()->toArray();
        if (!empty($res)) {
          $code =    password_verify($request->password,$res[0]['password']);
          if($code == true){
              return $this->return_json(200, $res, '登录成功');
          }
        } else {
            return $this->return_json(201, '', '账号不存在');
        }
    }

    public function text()
    {
      dd(password_hash('123',PASSWORD_DEFAULT))  ;
    }
}